/**
 * @param {number} n
 * @return {number}
 */
var climbStairs = function(n) {
  var cache = new Map();
  var result
  var goClimbStairs = function (n) {
    if (cache.has(n)) {
      return cache.get(n)
    }
    if (n < 4) {
      result = n
    } else {
      result = goClimbStairs(n - 1) + goClimbStairs(n - 2)
    }
    cache.set(n, result)
    return result
  }
  return goClimbStairs(n)
};
console.time('计算')
console.log(climbStairs(10000))
console.timeEnd('计算')